/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.service.impl;

import cn.yzc.mapper.AttachmentMapper;
import cn.yzc.mapper.TaskMapper;
import cn.yzc.mapper.UserTaskMapper;
import cn.yzc.pojo.Task;
import cn.yzc.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>Project: SpringPro - TaskServiceImpl</p>
 * <p>Powered by yzc On 2023-10-26 14:23:48</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */

@Service
public class TaskServiceImpl implements TaskService {

    @Autowired
    TaskMapper taskMapper;

    @Autowired
    UserTaskMapper userTaskMapper;

    @Autowired
    AttachmentMapper attachmentMapper;

    @Transactional
    @Override
    public int updateTask(Task task) {
        taskMapper.updateTask(task);
        userTaskMapper.delById(task.getId());
        if (task.getUserList().size() > 0 && task.getUserList() != null) {
            int rs = userTaskMapper.insert(task.getUserList(), task.getId());
        }


        return 1;
    }
}
